;
; Author: Javier Quevedo Fernandez
;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA



;; -------------------------------------------------------------------------------------------------------	
;; -------------------------------------------------------------------------------------------------------	
;;					PROGRAMA PRINCIPAL
;; -------------------------------------------------------------------------------------------------------
;; -------------------------------------------------------------------------------------------------------

	$NOMOD51
$INCLUDE(8052.MCU)		; Simbolos 8052
$INCLUDE(labels.asm)		; Labels
$INCLUDE(rtis.asm)		; Interrupciones	   -->  0200H
$INCLUDE(lcd.asm)		; LCD			   -->  0400H
$INCLUDE(math.asm)		; MATH			   -->  0600H
$INCLUDE(sensor.asm)		; Sensor		   -->  0800H
$INCLUDE(ia.asm)		; Inteligencia Artificial  -->  0A00H
$INCLUDE(strings.asm)		; Strings     		   -->  1700H
$INCLUDE(motor.asm)		; Motor			   -->  1580H
	
		ORG 0000H

			LJMP START
	
	ORG 0100H
	
START:	
			CLR	PUERTO_SENSOR
			MOV	SP,#80H
			CLR	RS0
			SETB	RS1
			ANL	P1,#00FH
	
			LCALL	SENSOR_INIT
			LCALL	MOTOR_INIT
			LCALL   LCD_INIT
			LCALL	INTERRUPT_INIT

			LCALL	LCD_WRITE_DISTANCE
	




		
			LCALL	IA

			END